<template>
	<div id="container">

		<el-form ref="loginFrom" :model="loginFrom" label-width="80px">
			<el-form-item>
				<el-input v-model="loginFrom.username" placeholder="请输入账号"></el-input>
			</el-form-item>
			<el-form-item>
				<el-input v-model="loginFrom.password" placeholder="请输入密码"></el-input>
			</el-form-item>
		 <el-form-item>
				<el-button type="primary" @click="dologin">登录</el-button>
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				loginFrom:{
					username:'admin',
					password:'123456'
				}
			}
		},
		methods: {
			dologin(){
				//发起请求
				this.$store.dispatch('user/login', this.loginFrom).then(() => {
					//路由跳转
					this.$router.push({ path: '/' },() => {})
				}).catch(() => {
					
				})
			}
		}
	}
</script>

<style>
</style>
